﻿@model Tippelde.Web.Models.Event.CreateEventModel
@{
    ViewBag.Title = "Esemény létrehozása";
    string actionName = ViewBag.Action;
}

<div class="row">
<div class="col-md-12">
<div class="well">
@using(Html.BeginForm(actionName, "Event", FormMethod.Post, new { @class="form-horizontal"}))
{
    @Html.ValidationSummary();
    @Html.AntiForgeryToken();
<fieldset>
    @Html.HiddenFor( m => m.Id)
    <legend>Esemény @(actionName=="Edit" ? "módosítása" : "létrehozása")</legend>
    <div class="col-md-6">
    <div class="form-group">
        @Html.LabelFor( m => m.EventName, new { @class="col-lg-4 control-label"})
        <div class="col-lg-8">
            @Html.TextBoxFor( m => m.EventName, new { @class="form-control", placeholder=Html.DisplayNameOf(m=>m.EventName)})
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.ShortName, new { @class="col-lg-4 control-label"})
        <div class="col-lg-8">
            @Html.TextBoxFor(m => m.ShortName, new { @class = "form-control", placeholder = Html.DisplayNameOf(m => m.ShortName) })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.Description, new { @class="col-lg-4 control-label"})
        <div class="col-lg-8">
            @Html.TextAreaFor(m => m.Description, new { @class = "form-control", placeholder = Html.DisplayNameOf(m => m.Description) })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.Status, new { @class="col-lg-4 control-label"})
        <div class="col-lg-8">
            @Html.EnumDropDownListFor( m => m.Status, new { @class="form-control"})
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.EventDate, new { @class="col-lg-4 control-label"})
        <div class="col-md-8">
            @Html.TextBoxFor(m => m.EventDate, "{0:yyyy-MM-dd'T'HH:mm:ss}", new { @class = "form-control input-sm", @type = "datetime-local" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.BetStartAt, new { @class="col-lg-4 control-label"})
        <div class="col-md-8">
            @Html.TextBoxFor(m => m.BetStartAt, "{0:yyyy-MM-dd'T'HH:mm:ss}", new { @class = "form-control input-sm", @type = "datetime-local" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor( m => m.BetEndAt, new { @class="col-lg-4 control-label"})
        <div class="col-md-8">
            @Html.TextBoxFor( m => m.BetEndAt, "{0:yyyy-MM-dd'T'HH:mm:ss}", new { @class="form-control input-sm", @type="datetime-local"})
        </div>
    </div>
    <div class="form-group">
        <div class="col-lg-8 col-lg-offset-4">
            <button type="submit" class="btn btn-primary">Mentés</button>
        </div>
    </div>
</div>
<div class="col-md-6">
        <div class="form-group">
            @Html.LabelFor( m => m.HomeTeamId, new { @class="col-lg-4 control-label"})
        <select id="homeTeam" class="teamSelector">
            <option value="">@Model.HomeTeamName</option>
        </select>
        @Html.HiddenFor( m=> m.HomeTeamId)  
        </div>
        <div class="form-group">
            @Html.LabelFor( m => m.AwayTeamId, new { @class="col-lg-4 control-label"})
        <select id="awayTeam" class="teamSelector">
            <option value="">@Model.AwayTeamName</option>
        </select>    
        @Html.HiddenFor( m=> m.AwayTeamId)  
        </div>
<div class="form-group">
        @Html.LabelFor( m => m.Groups, new { @class="control-label"})
        @{ Html.RenderPartial("_GroupSelector", Model.GroupList, new ViewDataDictionary{ {"ModelName", "Groups"} }); }
</div>
</div>
</fieldset>
}
</div>
</div>
</div>
@section scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/tippelde-teamselector")
<script type="text/javascript">
    Tippelde.TeamSelector('@Url.Action("Search", "Team")', '.teamSelector');
</script>
}